import React, { Component } from "react";

import LoginForm from "./LoginForm";
import RegisterForm from "./RegisterForm";
import "./login.scss";
export default class Index extends Component {
  constructor(props) {
    super(props);
    this.state = { status: "login" };
  }
  handleChangeStatus = (status) => {
    this.setState({
      status,
    });
  };
  render() {
    return (
      <div className="form_wrap">
        <div>
          <div className="form_header">
            <h4
              className="column"
              onClick={() => {
                this.handleChangeStatus("login");
              }}
              style={{ cursor: "pointer" }}
            >
              登录
            </h4>
            <span
              onClick={() => {
                this.handleChangeStatus("register");
              }}
              style={{ cursor: "pointer" }}
            >
              账号注册
            </span>
          </div>
          <div className="form_content">
            {this.state.status === "login" ? <LoginForm /> : <RegisterForm />}
          </div>
        </div>
      </div>
    );
  }
}
